import json

# 读取 data.json 文件里的数据, 变成字典
with open("data.json", "r", encoding="utf-8") as f:
    data1 = json.load(f)
    print(data1)
    print(type(data1)) # 输出: <class 'dict'>

# 把字典写入 json 文件 "data2.json" 中 ---解决中文写入问题
data2 = data1
with open("data2.json", "w", encoding="utf-8") as f:
    json.dump(data2, f, ensure_ascii=False)
